#include "maincontroller.h"
#include "logger.h"

using namespace controllers;
using namespace utilities;

MainController::MainController()
{
}

MainController::~MainController()
{
    delete(_cameraThread);
    delete(_informationThread);
}

void MainController::setCameraThread(CameraThread* ct)
{
    _cameraThread = ct;
}

void MainController::setInformationThread(InformationThread* it)
{
    _informationThread = it;
}

void MainController::startCameraThread()
{
    Logger::logMessage("MainController::startCameraThread()");
    _cameraThread->start();
}

void MainController::stopCameraThread()
{
    Logger::logMessage("MainController::stopCameraThread()");
    _cameraThread->terminate(); // terminate() + wait()
}

void MainController::takeReferenceImage()
{
    Logger::logMessage("MainController::takeReferenceImage()");
    _cameraThread->saveReferenceImage();
}

void MainController::takeSnapshotImage()
{
    Logger::logMessage("MainController::takeSnapshotImage()");
    _cameraThread->takeSnapshotImage();
}

void MainController::recordVideo()
{
    Logger::logMessage("MainController::recordVideo()");
    _cameraThread->recordVideo();
}

void MainController::recognizeObject()
{
    Logger::logMessage("MainController::recognizeObject()");
    _cameraThread->startObjectRecognition();
}
